import HomeView from "../views/HomeView.vue";
import NotFoundView from "../views/NotFound.vue";

let routes = [
  {
    path: "/",
    name: "home",
    component: HomeView,
  },
  {
    path: "/about",
    name: "about",
    component: () => import("../views/AboutView.vue"),
  },
  {
    path: "/options",
    name: "options",
    component: () => import("../views/OptionsView.vue"),
  },
  {
    path: "/setup",
    name: "setup",
    component: () => import("../views/SetUpView.vue"),
  },
  {
    path: "/vantui",
    name: "vantui",
    component: () => import("../views/VantView.vue"),
  },
  {
    path: "/404",
    name: "notFound",
    component: NotFoundView,
  },
  {
    // path: "*",   vue-router3 (配合vue2)
    path: '/:pathMatch(.*)*',  // vue-router4(配合vue3  -> 动态路径匹配)
    redirect: (to) => {
      console.log(to);  //当前路由信息 
      return { name: "notFound", query: { wd: to.params.pathMatch } }
    }
  },
];

export default routes